package www.tshu.servlet;

import www.tshu.pojo.User;
import www.tshu.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/ServletSelectPwd")
public class ServletSelectPwd extends HttpServlet {
    private User user;
    private UserServiceImpl userServiceImpl = new UserServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String unum=(String) req.getSession().getAttribute("unum");
       user = new User();
        user.setUnum(unum);
        User rs = userServiceImpl.login1(user);
        String upwd =rs.getUpwd();
        req.setAttribute("upwd",upwd);
        req.getRequestDispatcher("user/selectPwd.jsp").forward(req,resp);

    }
}
